package com.winit.agent.repository;

import com.winit.agent.model.Agent;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AgentRepository extends CrudRepository<Agent, String> {
    @Query(value = "select * from matrix_agent where 1 = 1 and(?1 is null or agent_id = ?1) and(?2 is null or agent_ip = ?2)", nativeQuery = true)
    List<Agent> findByAgentIdAndAgentIp(String agentId, String agentIp);
}
